home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Digital Signatures / Digital Signature Demo / Source ƒ / CSignedDataFile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-11  |  2.4 KB  |  82 lines  |  [TEXT/KAHL]

  1. /*
  2.  * CSignedDataFile.h
  3.  * Copyright © 1993 Apple Computer Inc.
  4.  * All Rights Reserved
  5.  *
  6.  * This subclass to CDataFile performs file-level
  7.  * Digital Signature processing according to the
  8.  * following model:
  9.  *
  10.  * If the file has a signature, it will be checked
  11.  * and a Failure condition raised if the signature
  12.  * is not verified. If the signature verifies correctly,
  13.  * the signer will be displayed in a Modal Dialog
  14.  * window.
  15.  *
  16.  * To sign a file, your application should execute
  17.  *    myFile->SignFileOnClose(TRUE) before closing
  18.  * the file. The signature will be appended when
  19.  * the file is closed.
  20.  */
  21. #define _H_CSignedDataFile
  22. #include <DigitalSignature.h>
  23. #include "CSignature.h"
  24.  
  25. struct CSignedDataFile : CSignature {
  26. public:
  27.         void                        ISignedDataFile(void);
  28.         /*
  29.          * SignFile signs a complete file. Your application
  30.          * must call it in the following sequence:
  31.          * 1. Create a copy of the FSSpec associated with
  32.          *        this file.
  33.          * 2. Close the file (this deletes the CDataFile
  34.          *        copy of the FSSpec).
  35.          * 3. SignFile
  36.          *
  37.          * The parameters are as follows:
  38.          *    signerFile        if not NULL, it is a FSSpec
  39.          *                    defining the signer file. If
  40.          *                    NULL, SignFile prompts for
  41.          *                    a signer file (this is normal).
  42.          *    promptString    The prompt to use when asking
  43.          *                    for the signer file. Use
  44.          *                    "\p" for the default prompt.
  45.          *    dataFile        The file to sign.
  46.          *    statusProc        Pass NULL for no status window,
  47.          *                    gSIGStatusProc for a built-in
  48.          *                    status window, or a pointer to
  49.          *                    your application's statusProc.
  50.          */
  51.         void                        SignFile(
  52.             const FSSpec                *signerFile,
  53.             ConstStr255Param            promptString,
  54.             const FSSpec                *dataFile,
  55.             SIGStatusProcPtr            statusProc
  56.         );
  57.         /*
  58.          * VerifyFile verifies a complete file. The file
  59.          * may not be open. The parameters are as follows:
  60.          *    fileSpec        The file to verify.
  61.          *    statusProc        Pass NULL for no status window,
  62.          *                    gSIGStatusProc for a built-in
  63.          *                    status window, or a pointer to
  64.          *                    your application's statusProc.
  65.          */
  66.         void                        VerifyFile(
  67.             const FSSpec                *fileSpec,
  68.             SIGStatusProcPtr            statusProc
  69.         );
  70.         /*
  71.          * FileIsSigned indicates whether a file contains
  72.          * a signature. It does not process the signature.
  73.          * It returns TRUE if it has a signature, FALSE
  74.          * if it does not (error kSIGNoSignature), and
  75.          * fails on other errors.
  76.          */
  77.         Boolean                        FileIsSigned(
  78.             const FSSpec                *fileSpec
  79.         );
  80. };
  81.     
  82.